<template>
  <div class="data-statistics v-flex">
    <el-table
      :data="topicList"
      border
      style="width: 100%">
      <el-table-column label="序号" width="80px" align="center">
        <template scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="topic" min-width="250px" align="center" prop="topic" />
      <el-table-column label="发布者" align="center" prop="publisher" />
      <el-table-column label="订阅者" align="center" prop="subscriber" />
      <el-table-column label="备注" align="center" prop="remark" />
    </el-table>
  </div>
</template>

<script>
import { getListByDeviceIdentification } from '@/api/cms/winglinks/deviceTopic'
export default {
  name: 'TopicList',
  props: {
    'deviceIdentification': {
      type: String,
      required: true
    }
  },
  data() {
    return {
      topicList: []
    }
  },
  watch: {
    'deviceIdentification'() {
      this.getTopicList()
    }
  },
  mounted() {
    this.getTopicList()
  },
  methods: {
    getTopicList() {
      console.log(this.deviceIdentification)
      if (this.deviceIdentification) {
        getListByDeviceIdentification(this.deviceIdentification).then(res => {
          this.topicList = res.data
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
